home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / emacs-complete / fsf / emacs / info / emacs-9 < prev    next >
Encoding:
GNU Info File  |  1994-10-06  |  48.8 KB  |  1,158 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Auto Fill,  Next: Fill Commands,  Up: Filling
  6.  
  7. Auto Fill Mode
  8. --------------
  9.  
  10.    "Auto Fill" mode is a minor mode in which lines are broken
  11. automatically when they become too wide.  Breaking happens only when
  12. you type a SPC or RET.
  13.  
  14. `M-x auto-fill-mode'
  15.      Enable or disable Auto Fill mode.
  16.  
  17. `SPC'
  18. `RET'
  19.      In Auto Fill mode, break lines when appropriate.
  20.  
  21.    `M-x auto-fill-mode' turns Auto Fill mode on if it was off, or off
  22. if it was on.  With a positive numeric argument it always turns Auto
  23. Fill mode on, and with a negative argument always turns it off.  You can
  24. see when Auto Fill mode is in effect by the presence of the word `Fill'
  25. in the mode line, inside the parentheses.  Auto Fill mode is a minor
  26. mode which is enabled or disabled for each buffer individually.  *Note
  27. Minor Modes::.
  28.  
  29.    In Auto Fill mode, lines are broken automatically at spaces when
  30. they get longer than the desired width.  Line breaking and
  31. rearrangement takes place only when you type SPC or RET.  If you wish
  32. to insert a space or newline without permitting line-breaking, type
  33. `C-q SPC' or `C-q LFD' (recall that a newline is really a linefeed).
  34. Also, `C-o' inserts a newline without line breaking.
  35.  
  36.    Auto Fill mode works well with Lisp mode, because when it makes a new
  37. line in Lisp mode it indents that line with TAB.  If a line ending in a
  38. comment gets too long, the text of the comment is split into two
  39. comment lines.  Optionally new comment delimiters are inserted at the
  40. end of the first line and the beginning of the second so that each line
  41. is a separate comment; the variable `comment-multi-line' controls the
  42. choice (*note Comments::.).
  43.  
  44.    Auto Fill mode does not refill entire paragraphs; it can break lines
  45. but cannot merge lines.  So editing in the middle of a paragraph can
  46. result in a paragraph that is not correctly filled.  The easiest way to
  47. make the paragraph properly filled again is usually with the explicit
  48. fill commands.  *Note Fill Commands::.
  49.  
  50.    Many users like Auto Fill mode and want to use it in all text files.
  51. The section on init files says how to arrange this permanently for
  52. yourself.  *Note Init File::.
  53.  
  54. 
  55. File: emacs,  Node: Fill Commands,  Next: Fill Prefix,  Prev: Auto Fill,  Up: Filling
  56.  
  57. Explicit Fill Commands
  58. ----------------------
  59.  
  60. `M-q'
  61.      Fill current paragraph (`fill-paragraph').
  62.  
  63. `C-x f'
  64.      Set the fill column (`set-fill-column').
  65.  
  66. `M-x fill-region'
  67.      Fill each paragraph in the region (`fill-region').
  68.  
  69. `M-x fill-region-as-paragraph.'
  70.      Fill the region, considering it as one paragraph.
  71.  
  72. `M-s'
  73.      Center a line.
  74.  
  75.    To refill a paragraph, use the command `M-q' (`fill-paragraph').
  76. This operates on the paragraph that point is inside, or the one after
  77. point if point is between paragraphs.  Refilling works by removing all
  78. the line-breaks, then inserting new ones where necessary.
  79.  
  80.    To refill many paragraphs, use `M-x fill-region', which divides the
  81. region into paragraphs and fills each of them.
  82.  
  83.    `M-q' and `fill-region' use the same criteria as `M-h' for finding
  84. paragraph boundaries (*note Paragraphs::.).  For more control, you can
  85. use `M-x fill-region-as-paragraph', which refills everything between
  86. point and mark.  This command deletes any blank lines within the
  87. region, so separate blocks of text end up combined into one block.
  88.  
  89.    A numeric argument to `M-q' causes it to "justify" the text as well
  90. as filling it.  This means that extra spaces are inserted to make the
  91. right margin line up exactly at the fill column.  To remove the extra
  92. spaces, use `M-q' with no argument.  (Likewise for `fill-region'.)
  93.  
  94.    When `adaptive-fill-mode' is non-`nil' (which is normally the case),
  95. if you use `fill-region-as-paragraph' on an indented paragraph and you
  96. don't have a fill prefix, it uses the indentation of the second line of
  97. the paragraph as the fill prefix.  The effect of adaptive filling is
  98. not noticeable in Text mode, because an indented line counts as a
  99. paragraph starter and thus each line of an indented paragraph is
  100. considered a paragraph of its own.  But you do notice the effect in
  101. Indented Text mode and some other major modes.
  102.  
  103.    The command `M-s' (`center-line') centers the current line within
  104. the current fill column.  With an argument N, it centers N lines
  105. individually and moves past them.
  106.  
  107.    The maximum line width for filling is in the variable `fill-column'.
  108. Altering the value of `fill-column' makes it local to the current
  109. buffer; until that time, the default value is in effect.  The default
  110. is initially 70.  *Note Locals::.  The easiest way to set `fill-column'
  111. is to use the command `C-x f' (`set-fill-column').  With no argument,
  112. it sets `fill-column' to the current horizontal position of point.
  113. With a numeric argument, it uses that as the new fill column.
  114.  
  115.    Emacs commands normally consider a period followed by two spaces or
  116. by a newline as the end of a sentence; a period followed by just one
  117. space indicates an abbreviation and not the end of a sentence.  To
  118. preserve the distinction between these two ways of using a period, the
  119. fill commands do not break a line after a period followed by just one
  120. space.
  121.  
  122.    If the variable `sentence-end-double-space' is `nil', the fill
  123. commands expect and leave just one space at the end of a sentence.
  124. Ordinarily this variable is `t', so the fill commands insist on two
  125. spaces for the end of a sentence, as explained above.  *Note
  126. Sentences::.
  127.  
  128. 
  129. File: emacs,  Node: Fill Prefix,  Prev: Fill Commands,  Up: Filling
  130.  
  131. The Fill Prefix
  132. ---------------
  133.  
  134.    To fill a paragraph in which each line starts with a special marker
  135. (which might be a few spaces, giving an indented paragraph), use the
  136. "fill prefix" feature.  The fill prefix is a string which Emacs expects
  137. every line to start with, and which is not included in filling.
  138.  
  139. `C-x .'
  140.      Set the fill prefix (`set-fill-prefix').
  141.  
  142. `M-q'
  143.      Fill a paragraph using current fill prefix (`fill-paragraph').
  144.  
  145. `M-x fill-individual-paragraphs'
  146.      Fill the region, considering each change of indentation as
  147.      starting a new paragraph.
  148.  
  149. `M-x fill-nonuniform-paragraphs'
  150.      Fill the region, considering only paragraph-separator lines as
  151.      starting a new paragraph.
  152.  
  153.    To specify a fill prefix, move to a line that starts with the desired
  154. prefix, put point at the end of the prefix, and give the command
  155. `C-x .' (`set-fill-prefix').  That's a period after the `C-x'.  To turn
  156. off the fill prefix, specify an empty prefix: type `C-x .' with point
  157. at the beginning of a line.
  158.  
  159.    When a fill prefix is in effect, the fill commands remove the fill
  160. prefix from each line before filling and insert it on each line after
  161. filling.  Auto Fill mode also inserts the fill prefix automatically when
  162. it makes a new line.  The `C-o' command inserts the fill prefix on new
  163. lines it creates, when you use it at the beginning of a line (*note
  164. Blank Lines::.).  Conversely, the command `M-^' deletes the prefix (if
  165. it occurs) after the newline that it deletes (*note Indentation::.).
  166.  
  167.    For example, if `fill-column' is 40 and you set the fill prefix to
  168. `;; ', then `M-q' in the following text
  169.  
  170.      ;; This is an
  171.      ;; example of a paragraph
  172.      ;; inside a Lisp-style comment.
  173.  
  174. produces this:
  175.  
  176.      ;; This is an example of a paragraph
  177.      ;; inside a Lisp-style comment.
  178.  
  179.    Lines that do not start with the fill prefix are considered to start
  180. paragraphs, both in `M-q' and the paragraph commands; this is gives
  181. good results for paragraphs with hanging indentation (every line
  182. indented except the first one).  Lines which are blank or indented once
  183. the prefix is removed also separate or start paragraphs; this is what
  184. you want if you are writing multi-paragraph comments with a comment
  185. delimiter on each line.
  186.  
  187.    You can use `M-x fill-individual-paragraphs' to set the fill prefix
  188. for each paragraph automatically.  This command divides the region into
  189. paragraphs, treating every change in the amount of indentation as the
  190. start of a new paragraph, and fills each of these paragraphs.  Thus,
  191. all the lines in one "paragraph" have the same amount of indentation.
  192. That indentation serves as the fill prefix for that paragraph.
  193.  
  194.    `M-x fill-nonuniform-paragraphs' is a similar command that divides
  195. the region into paragraphs in a different way.  It considers only
  196. paragraph-separating lines (as defined by `paragraph-separate') as
  197. starting a new paragraph.  Since this means that the lines of one
  198. paragraph may have different amounts of indentation, the fill prefix
  199. used is the smallest amount of indentation of any of the lines of the
  200. paragraph.  This gives good results with styles that indent a
  201. paragraph's first line more or less that the rest of the paragraph.
  202.  
  203.    The fill prefix is stored in the variable `fill-prefix'.  Its value
  204. is a string, or `nil' when there is no fill prefix.  This is a
  205. per-buffer variable; altering the variable affects only the current
  206. buffer, but there is a default value which you can change as well.
  207. *Note Locals::.
  208.  
  209. 
  210. File: emacs,  Node: Case,  Next: Text Mode,  Prev: Filling,  Up: Text
  211.  
  212. Case Conversion Commands
  213. ========================
  214.  
  215.    Emacs has commands for converting either a single word or any
  216. arbitrary range of text to upper case or to lower case.
  217.  
  218. `M-l'
  219.      Convert following word to lower case (`downcase-word').
  220.  
  221. `M-u'
  222.      Convert following word to upper case (`upcase-word').
  223.  
  224. `M-c'
  225.      Capitalize the following word (`capitalize-word').
  226.  
  227. `C-x C-l'
  228.      Convert region to lower case (`downcase-region').
  229.  
  230. `C-x C-u'
  231.      Convert region to upper case (`upcase-region').
  232.  
  233.    The word conversion commands are the most useful.  `M-l'
  234. (`downcase-word') converts the word after point to lower case, moving
  235. past it.  Thus, repeating `M-l' converts successive words.  `M-u'
  236. (`upcase-word') converts to all capitals instead, while `M-c'
  237. (`capitalize-word') puts the first letter of the word into upper case
  238. and the rest into lower case.  All these commands convert several words
  239. at once if given an argument.  They are especially convenient for
  240. converting a large amount of text from all upper case to mixed case,
  241. because you can move through the text using `M-l', `M-u' or `M-c' on
  242. each word as appropriate, occasionally using `M-f' instead to skip a
  243. word.
  244.  
  245.    When given a negative argument, the word case conversion commands
  246. apply to the appropriate number of words before point, but do not move
  247. point.  This is convenient when you have just typed a word in the wrong
  248. case: you can give the case conversion command and continue typing.
  249.  
  250.    If a word case conversion command is given in the middle of a word,
  251. it applies only to the part of the word which follows point.  This is
  252. just like what `M-d' (`kill-word') does.  With a negative argument,
  253. case conversion applies only to the part of the word before point.
  254.  
  255.    The other case conversion commands are `C-x C-u' (`upcase-region')
  256. and `C-x C-l' (`downcase-region'), which convert everything between
  257. point and mark to the specified case.  Point and mark do not move.
  258.  
  259.    The region case conversion commands `upcase-region' and
  260. `downcase-region' are normally disabled.  This means that they ask for
  261. confirmation if you try to use them.  When you confirm, you may enable
  262. the command, which means it will not ask for confirmation again.  *Note
  263. Disabling::.
  264.  
  265. 
  266. File: emacs,  Node: Text Mode,  Next: Outline Mode,  Prev: Case,  Up: Text
  267.  
  268. Text Mode
  269. =========
  270.  
  271.    When you edit files of text in a human language, it's more convenient
  272. to use Text mode rather than Fundamental mode.  Invoke `M-x text-mode'
  273. to enter Text mode.  In Text mode, TAB runs the function
  274. `tab-to-tab-stop', which allows you to use arbitrary tab stops set with
  275. `M-x edit-tab-stops' (*note Tab Stops::.).  Features concerned with
  276. comments in programs are turned off in Text mode except when explicitly
  277. invoked.  The syntax table is changed so that periods are not
  278. considered part of a word, while apostrophes, backspaces and underlines
  279. are part of words.
  280.  
  281.    A similar variant mode is Indented Text mode, intended for editing
  282. text in which most lines are indented.  This mode defines TAB to run
  283. `indent-relative' (*note Indentation::.), and makes Auto Fill indent
  284. the lines it creates.  The result is that normally a line made by Auto
  285. Filling, or by LFD, is indented just like the previous line.  In
  286. Indented Text mode, only blank lines separate paragraphs--indented
  287. lines continue the current paragraph.  Use `M-x indented-text-mode' to
  288. select this mode.
  289.  
  290.    Text mode, and all the modes based on it, define `M-TAB' as the
  291. command `ispell-complete-word', which performs completion of the
  292. partial word in the buffer before point, using the spelling dictionary
  293. as the space of possible words.  *Note Spelling::.
  294.  
  295.    Entering Text mode or Indented Text mode runs the hook
  296. `text-mode-hook'.  Other major modes related to Text mode also run this
  297. hook, followed by hooks of their own; this includes Nroff mode, TeX
  298. mode, Outline mode and Mail mode.  Hook functions on `text-mode-hook'
  299. can look at the value of `major-mode' to see which of these modes is
  300. actually being entered.  *Note Hooks::.
  301.  
  302. * Menu:
  303.  
  304.   Emacs provides two other modes for editing text that is to be passed
  305. through a text formatter to produce fancy formatted printed output.
  306.  
  307. * Nroff Mode::      The major mode for editing input to the formatter nroff.
  308. * TeX Mode::      The major modes for editing input to the formatter TeX.
  309.  
  310.   Another mode is used for editing outlines.  It allows you to view the
  311. text at various levels of detail.  You can view either the outline
  312. headings alone or both headings and text; you can also hide some of the
  313. headings at lower levels from view to make the high level structure more
  314. visible.
  315.  
  316. * Outline Mode::  The major mode for editing outlines.
  317.  
  318. 
  319. File: emacs,  Node: Outline Mode,  Next: TeX Mode,  Prev: Text Mode,  Up: Text
  320.  
  321. Outline Mode
  322. ============
  323.  
  324.    Outline mode is a major mode much like Text mode but intended for
  325. editing outlines.  It allows you to make parts of the text temporarily
  326. invisible so that you can see the outline structure.  Type `M-x
  327. outline-mode' to switch to Outline mode as the major mode of the current
  328. buffer.  Type `M-x outline-minor-mode' to enable Outline mode as a
  329. minor mode in the current buffer.  Outline minor mode provides the same
  330. commands as the major mode, Outline mode, but you can use it in
  331. conjunction with other major modes.
  332.  
  333.    The major mode, Outline mode, provides special key bindings on the
  334. `C-c' prefix.  Outline minor mode provides similar bindings with `C-c
  335. C-o' as the prefix; this is to reduce the conflicts with the major
  336. mode's special commands.  (The variable `outline-minor-mode-prefix'
  337. controls the prefix used.)
  338.  
  339.    When Outline mode makes a line invisible, the line does not appear on
  340. the screen.  The screen appears exactly as if the invisible line were
  341. deleted, except that an ellipsis (three periods in a row) appears at the
  342. end of the previous visible line (only one ellipsis no matter how many
  343. invisible lines follow).
  344.  
  345.    All editing commands treat the text of the invisible line as part of
  346. the previous visible line.  For example, `C-n' moves onto the next
  347. visible line.  Killing an entire visible line, including its
  348. terminating newline, really kills all the following invisible lines
  349. along with it; yanking it all back yanks the invisible lines and they
  350. remain invisible.
  351.  
  352.    Entering Outline mode runs the hook `text-mode-hook' followed by the
  353. hook `outline-mode-hook' (*note Hooks::.).
  354.  
  355. * Menu:
  356.  
  357. * Format: Outline Format.       What the text of an outline looks like.
  358. * Motion: Outline Motion.       Special commands for moving through
  359.                                      outlines.
  360. * Visibility: Outline Visibility.  Commands to control what is visible.
  361.  
  362. 
  363. File: emacs,  Node: Outline Format,  Next: Outline Motion,  Up: Outline Mode
  364.  
  365. Format of Outlines
  366. ------------------
  367.  
  368.    Outline mode assumes that the lines in the buffer are of two types:
  369. "heading lines" and "body lines".  A heading line represents a topic in
  370. the outline.  Heading lines start with one or more stars; the number of
  371. stars determines the depth of the heading in the outline structure.
  372. Thus, a heading line with one star is a major topic; all the heading
  373. lines with two stars between it and the next one-star heading are its
  374. subtopics; and so on.  Any line that is not a heading line is a body
  375. line.  Body lines belong with the preceding heading line.  Here is an
  376. example:
  377.  
  378.      * Food
  379.      
  380.      This is the body,
  381.      which says something about the topic of food.
  382.      
  383.      ** Delicious Food
  384.      
  385.      This is the body of the second-level header.
  386.      
  387.      ** Distasteful Food
  388.      
  389.      This could have
  390.      a body too, with
  391.      several lines.
  392.      
  393.      *** Dormitory Food
  394.      
  395.      * Shelter
  396.      
  397.      Another first-level topic with its header line.
  398.  
  399.    A heading line together with all following body lines is called
  400. collectively an "entry".  A heading line together with all following
  401. deeper heading lines and their body lines is called a "subtree".
  402.  
  403.    You can customize the criterion for distinguishing heading lines by
  404. setting the variable `outline-regexp'.  Any line whose beginning has a
  405. match for this regexp is considered a heading line.  Matches that start
  406. within a line (not at the left margin) do not count.  The length of the
  407. matching text determines the level of the heading; longer matches make
  408. a more deeply nested level.  Thus, for example, if a text formatter has
  409. commands `@chapter', `@section' and `@subsection' to divide the
  410. document into chapters and sections, you could make those lines count
  411. as heading lines by setting `outline-regexp' to
  412. `"@chap\\|@\\(sub\\)*section"'.  Note the trick: the two words
  413. `chapter' and `section' are equally long, but by defining the regexp to
  414. match only `chap' we ensure that the length of the text matched on a
  415. chapter heading is shorter, so that Outline mode will know that
  416. sections are contained in chapters.  This works as long as no other
  417. command starts with `@chap'.
  418.  
  419.    It is possible to change the rule for calculating the level of a
  420. heading line by setting the variable `outline-level'.  The value of
  421. `outline-level' should be a function that takes no arguments and
  422. returns the level of the current heading.  Some major modes such as C,
  423. Nroff, and Emacs Lisp mode set this variable in order to work with
  424. Outline minor mode.
  425.  
  426.    Outline mode makes a line invisible by changing the newline before it
  427. into an ASCII control-M (code 015).  Most editing commands that work on
  428. lines treat an invisible line as part of the previous line because,
  429. strictly speaking, it *is* part of that line, since there is no longer a
  430. newline in between.  When you save the file in Outline mode, control-M
  431. characters are saved as newlines, so the invisible lines become ordinary
  432. lines in the file.  But saving does not change the visibility status of
  433. a line inside Emacs.
  434.  
  435. 
  436. File: emacs,  Node: Outline Motion,  Next: Outline Visibility,  Prev: Outline Format,  Up: Outline Mode
  437.  
  438. Outline Motion Commands
  439. -----------------------
  440.  
  441.    There are some special motion commands in Outline mode that move
  442. backward and forward to heading lines.
  443.  
  444. `C-c C-n'
  445.      Move point to the next visible heading line
  446.      (`outline-next-visible-heading').
  447.  
  448. `C-c C-p'
  449.      Move point to the previous visible heading line
  450.      (`outline-previous-visible-heading').
  451.  
  452. `C-c C-f'
  453.      Move point to the next visible heading line at the same level as
  454.      the one point is on (`outline-forward-same-level').
  455.  
  456. `C-c C-b'
  457.      Move point to the previous visible heading line at the same level
  458.      (`outline-backward-same-level').
  459.  
  460. `C-c C-u'
  461.      Move point up to a lower-level (more inclusive) visible heading
  462.      line (`outline-up-heading').
  463.  
  464.    `C-c C-n' (`next-visible-heading') moves down to the next heading
  465. line.  `C-c C-p' (`previous-visible-heading') moves similarly backward.
  466. Both accept numeric arguments as repeat counts.  The names emphasize
  467. that invisible headings are skipped, but this is not really a special
  468. feature.  All editing commands that look for lines ignore the invisible
  469. lines automatically.
  470.  
  471.    More powerful motion commands understand the level structure of
  472. headings.  `C-c C-f' (`outline-forward-same-level') and `C-c C-b'
  473. (`outline-backward-same-level') move from one heading line to another
  474. visible heading at the same depth in the outline.  `C-c C-u'
  475. (`outline-up-heading') moves backward to another heading that is less
  476. deeply nested.
  477.  
  478. 
  479. File: emacs,  Node: Outline Visibility,  Prev: Outline Motion,  Up: Outline Mode
  480.  
  481. Outline Visibility Commands
  482. ---------------------------
  483.  
  484.    The other special commands of outline mode are used to make lines
  485. visible or invisible.  Their names all start with `hide' or `show'.
  486. Most of them fall into pairs of opposites.  They are not undoable;
  487. instead, you can undo right past them.  Making lines visible or
  488. invisible is simply not recorded by the undo mechanism.
  489.  
  490. `C-c C-t'
  491.      Make all body lines in the buffer invisible (`hide-body').
  492.  
  493. `C-c C-a'
  494.      Make all lines in the buffer visible (`show-all').
  495.  
  496. `C-c C-d'
  497.      Make everything under this heading invisible, not including this
  498.      heading itself
  499.      (`hide-subtree').
  500.  
  501. `C-c C-s'
  502.      Make everything under this heading visible, including body,
  503.      subheadings, and their bodies (`show-subtree').
  504.  
  505. `C-c C-l'
  506.      Make the body of this heading line, and of all its subheadings,
  507.      invisible (`hide-leaves').
  508.  
  509. `C-c C-k'
  510.      Make all subheadings of this heading line, at all levels, visible
  511.      (`show-branches').
  512.  
  513. `C-c C-i'
  514.      Make immediate subheadings (one level down) of this heading line
  515.      visible (`show-children').
  516.  
  517. `C-c C-c'
  518.      Make this heading line's body invisible (`hide-entry').
  519.  
  520. `C-c C-e'
  521.      Make this heading line's body visible (`show-entry').
  522.  
  523. `C-c C-q'
  524.      Hide everything except the top N levels of heading lines
  525.      (`hide-sublevels').
  526.  
  527. `C-c C-o'
  528.      Hide everything except for the heading or body that point is in,
  529.      plus the headings leading up from there to the top level of the
  530.      outline (`hide-other').
  531.  
  532.    Two commands that are exact opposites are `C-c C-c' (`hide-entry')
  533. and `C-c C-e' (`show-entry').  They are used with point on a heading
  534. line, and apply only to the body lines of that heading.  Subheadings
  535. and their bodies are not affected.
  536.  
  537.    Two more powerful opposites are `C-c C-d' (`hide-subtree') and `C-c
  538. C-s' (`show-subtree').  Both expect to be used when point is on a
  539. heading line, and both apply to all the lines of that heading's
  540. "subtree": its body, all its subheadings, both direct and indirect, and
  541. all of their bodies.  In other words, the subtree contains everything
  542. following this heading line, up to and not including the next heading of
  543. the same or higher rank.
  544.  
  545.    Intermediate between a visible subtree and an invisible one is having
  546. all the subheadings visible but none of the body.  There are two
  547. commands for doing this, depending on whether you want to hide the
  548. bodies or make the subheadings visible.  They are `C-c C-l'
  549. (`hide-leaves') and `C-c C-k' (`show-branches').
  550.  
  551.    A little weaker than `show-branches' is `C-c C-i' (`show-children').
  552. It makes just the direct subheadings visible--those one level down.
  553. Deeper subheadings remain invisible, if they were invisible.
  554.  
  555.    Two commands have a blanket effect on the whole file.  `C-c C-t'
  556. (`hide-body') makes all body lines invisible, so that you see just the
  557. outline structure.  `C-c C-a' (`show-all') makes all lines visible.
  558. These commands can be thought of as a pair of opposites even though
  559. `C-c C-a' applies to more than just body lines.
  560.  
  561.    The command `C-c C-q' (`hide-sublevels') hides all but the top level
  562. headings.  With a numeric argument N, it hides everything except the
  563. top N levels of heading lines.
  564.  
  565.    The command `C-c C-o' (`hide-other') hides everything except the
  566. heading or body text that point is in, plus its parents (the headers
  567. leading up from there to top level in the outline).
  568.  
  569.    You can turn off the use of ellipses at the ends of visible lines by
  570. setting `selective-display-ellipses' to `nil'.  Then there is no
  571. visible indication of the presence of invisible lines.
  572.  
  573. 
  574. File: emacs,  Node: TeX Mode,  Next: Nroff Mode,  Prev: Outline Mode,  Up: Text
  575.  
  576. TeX Mode
  577. ========
  578.  
  579.    TeX is a powerful text formatter written by Donald Knuth; it is also
  580. free, like GNU Emacs.  LaTeX is a simplified input format for TeX,
  581. implemented by TeX macros; it comes with TeX.  SliTeX is a special form
  582. of LaTeX.
  583.  
  584.    Emacs has a special TeX mode for editing TeX input files.  It
  585. provides facilities for checking the balance of delimiters and for
  586. invoking TeX on all or part of the file.
  587.  
  588.    TeX mode has three variants, Plain TeX mode, LaTeX mode, and SliTeX
  589. mode (these three distinct major modes differ only slightly).  They are
  590. designed for editing the three different formats.  The command `M-x
  591. tex-mode' looks at the contents of the buffer to determine whether the
  592. contents appear to be either LaTeX input or SliTeX input; if so, it
  593. selects the appropriate mode.  If the file contents do not appear to be
  594. LaTeX or SliTeX, it selects Plain TeX mode.  If the contents are
  595. insufficient to determine this, the variable `tex-default-mode'
  596. controls which mode is used.
  597.  
  598.    When `M-x tex-mode' does not guess right, you can use the commands
  599. `M-x plain-tex-mode', `M-x latex-mode', and `M-x slitex-mode' to select
  600. explicitly the particular variants of TeX mode.
  601.  
  602. * Menu:
  603.  
  604. * Editing: TeX Editing.   Special commands for editing in TeX mode.
  605. * LaTeX: LaTeX Editing.   Additional commands for LaTeX input files.
  606. * Printing: TeX Print.    Commands for printing part of a file with TeX.
  607. * Getting: TeX Distrib.   Getting the latest Unix TeX distribution.
  608.  
  609. 
  610. File: emacs,  Node: TeX Editing,  Next: LaTeX Editing,  Up: TeX Mode
  611.  
  612. TeX Editing Commands
  613. --------------------
  614.  
  615.    Here are the special commands provided in TeX mode for editing the
  616. text of the file.
  617.  
  618. `"'
  619.      Insert, according to context, either ```' or `"' or `'''
  620.      (`tex-insert-quote').
  621.  
  622. `LFD'
  623.      Insert a paragraph break (two newlines) and check the previous
  624.      paragraph for unbalanced braces or dollar signs
  625.      (`tex-terminate-paragraph').
  626.  
  627. `M-x validate-tex-region'
  628.      Check each paragraph in the region for unbalanced braces or dollar
  629.      signs.
  630.  
  631. `C-c {'
  632.      Insert `{}' and position point between them (`tex-insert-braces').
  633.  
  634. `C-c }'
  635.      Move forward past the next unmatched close brace (`up-list').
  636.  
  637.    In TeX, the character `"' is not normally used; we use ```' to start
  638. a quotation and `''' to end one.  To make editing easier under this
  639. formatting convention, TeX mode overrides the normal meaning of the key
  640. `"' with a command that inserts a pair of single-quotes or backquotes
  641. (`tex-insert-quote').  To be precise, this command inserts ```' after
  642. whitespace or an open brace, `"' after a backslash, and `''' after any
  643. other character.
  644.  
  645.    If you need the character `"' itself in unusual contexts, use `C-q'
  646. to insert it.  Also, `"' with a numeric argument always inserts that
  647. number of `"' characters.
  648.  
  649.    In TeX mode, `$' has a special syntax code which attempts to
  650. understand the way TeX math mode delimiters match.  When you insert a
  651. `$' that is meant to exit math mode, the position of the matching `$'
  652. that entered math mode is displayed for a second.  This is the same
  653. feature that displays the open brace that matches a close brace that is
  654. inserted.  However, there is no way to tell whether a `$' enters math
  655. mode or leaves it; so when you insert a `$' that enters math mode, the
  656. previous `$' position is shown as if it were a match, even though they
  657. are actually unrelated.
  658.  
  659.    TeX uses braces as delimiters that must match.  Some users prefer to
  660. keep braces balanced at all times, rather than inserting them singly.
  661. Use `C-c {' (`tex-insert-braces') to insert a pair of braces.  It
  662. leaves point between the two braces so you can insert the text that
  663. belongs inside.  Afterward, use the command `C-c }' (`up-list') to move
  664. forward past the close brace.
  665.  
  666.    There are two commands for checking the matching of braces.  LFD
  667. (`tex-terminate-paragraph') checks the paragraph before point, and
  668. inserts two newlines to start a new paragraph.  It prints a message in
  669. the echo area if any mismatch is found.  `M-x validate-tex-region'
  670. checks a region, paragraph by paragraph.  When it finds a paragraph that
  671. contains a mismatch, it displays point at the beginning of the paragraph
  672. for a few seconds and sets the mark at that spot.  Scanning continues
  673. until the whole buffer has been checked or until you type another key.
  674. Afterward, you can use the mark ring to find the last several paragraphs
  675. that had mismatches (*note Mark Ring::.).
  676.  
  677.    Note that Emacs commands count square brackets and parentheses in
  678. TeX mode, not just braces.  This is not strictly correct for the
  679. purpose of checking TeX syntax.  However, parentheses and square
  680. brackets are likely to be used in text as matching delimiters and it is
  681. useful for the various motion commands and automatic match display to
  682. work with them.
  683.  
  684. 
  685. File: emacs,  Node: LaTeX Editing,  Next: TeX Print,  Prev: TeX Editing,  Up: TeX Mode
  686.  
  687. LaTeX Editing Commands
  688. ----------------------
  689.  
  690.    LaTeX mode, and its variant, SliTeX mode, provide a few extra
  691. features not applicable to plain TeX.
  692.  
  693. `C-c C-o'
  694.      Insert `\begin' and `\end' for LaTeX block and position point on a
  695.      line between them. (`tex-latex-block').
  696.  
  697. `C-c C-e'
  698.      Close the last unended block for LaTeX (`tex-close-latex-block').
  699.  
  700.    In LaTeX input, `\begin' and `\end' commands are used to group
  701. blocks of text.  To insert a `\begin' and a matching `\end' (on a new
  702. line following the `\begin'), use `C-c C-o' (`tex-latex-block').  A
  703. blank line is inserted between the two, and point is left there.  You
  704. can use completion when you enter the block type; to specify additional
  705. block type names beyond the standard list, set the variable
  706. `latex-block-names'.  For example, here's how to add `theorem',
  707. `corollary', and `proof':
  708.  
  709.      (setq latex-block-names '("theorem" "corollary" "proof"))
  710.  
  711.    In LaTeX input, `\begin' and `\end' commands must balance.  You can
  712. use `C-c C-e' (`tex-close-latex-block') to insert automatically a
  713. matching `\end' to match the last unmatched `\begin'.  It indents the
  714. `\end' to match the corresponding `\begin'.  It inserts a newline after
  715. `\end' if point is at the beginning of a line.
  716.  
  717. 
  718. File: emacs,  Node: TeX Print,  Next: TeX Distrib,  Prev: LaTeX Editing,  Up: TeX Mode
  719.  
  720. TeX Printing Commands
  721. ---------------------
  722.  
  723.    You can invoke TeX as an inferior of Emacs on either the entire
  724. contents of the buffer or just a region at a time.  Running TeX in this
  725. way on just one chapter is a good way to see what your changes look
  726. like without taking the time to format the entire file.
  727.  
  728. `C-c C-r'
  729.      Invoke TeX on the current region, together with the buffer's header
  730.      (`tex-region').
  731.  
  732. `C-c C-b'
  733.      Invoke TeX on the entire current buffer (`tex-buffer').
  734.  
  735. `C-c TAB'
  736.      Invoke BibTeX on the current file (`tex-bibtex-file').
  737.  
  738. `C-c C-f'
  739.      Invoke TeX on the current file (`tex-file').
  740.  
  741. `C-c C-l'
  742.      Recenter the window showing output from the inferior TeX so that
  743.      the last line can be seen (`tex-recenter-output-buffer').
  744.  
  745. `C-c C-k'
  746.      Kill the TeX subprocess (`tex-kill-job').
  747.  
  748. `C-c C-p'
  749.      Print the output from the last `C-c C-r', `C-c C-b', or `C-c C-f'
  750.      command (`tex-print').
  751.  
  752. `C-c C-v'
  753.      Preview the output from the last `C-c C-r', `C-c C-b', or `C-c
  754.      C-f' command (`tex-view').
  755.  
  756. `C-c C-q'
  757.      Show the printer queue (`tex-show-print-queue').
  758.  
  759.    You can pass the current buffer through an inferior TeX by means of
  760. `C-c C-b' (`tex-buffer').  The formatted output appears in a temporary
  761. file; to print it, type `C-c C-p' (`tex-print').  Afterward, you can
  762. use `C-c C-q' (`tex-show-print-queue') to view the progress of your
  763. output towards being printed.  If your terminal has the ability to
  764. display TeX output files, you can preview the output on the terminal
  765. with `C-c C-v' (`tex-view').
  766.  
  767.    You can specify the directory to use for running TeX by setting the
  768. variable `tex-directory'.  `"."' is the default value.  If your
  769. environment variable `TEXINPUTS' contains relative directory names, or
  770. if your files contains `\input' commands with relative file names, then
  771. `tex-directory' *must* be `"."' or you will get the wrong results.
  772. Otherwise, it is safe to specify some other directory, such as `"/tmp"'.
  773.  
  774.    If you want to specify which shell commands are used in the inferior
  775. TeX, you can do so by setting the values of the variables
  776. `tex-run-command', `latex-run-command', `slitex-run-command',
  777. `tex-dvi-print-command', `tex-dvi-view-command', and
  778. `tex-show-queue-command'.  You *must* set the value of
  779. `tex-dvi-view-command' for your particular terminal; this variable has
  780. no default value.  The other variables have default values that may (or
  781. may not) be appropriate for your system.
  782.  
  783.    Normally, the file name given to these commands comes at the end of
  784. the command string; for example, `latex FILENAME'.  In some cases,
  785. however, the file name needs to be embedded in the command; an example
  786. is when you need to provide the file name as an argument to one command
  787. whose output is piped to another.  You can specify where to put the
  788. file name with `*' in the command string.  For example,
  789.  
  790.      (setq tex-dvi-print-command "dvips -f * | lpr")
  791.  
  792.    The terminal output from TeX, including any error messages, appears
  793. in a buffer called `*tex-shell*'.  If TeX gets an error, you can switch
  794. to this buffer and feed it input (this works as in Shell mode; *note
  795. Interactive Shell::.).  Without switching to this buffer you can scroll
  796. it so that its last line is visible by typing `C-c C-l'.
  797.  
  798.    Type `C-c C-k' (`tex-kill-job') to kill the TeX process if you see
  799. that its output is no longer useful.  Using `C-c C-b' or `C-c C-r' also
  800. kills any TeX process still running.
  801.  
  802.    You can also pass an arbitrary region through an inferior TeX by
  803. typing `C-c C-r' (`tex-region').  This is tricky, however, because most
  804. files of TeX input contain commands at the beginning to set parameters
  805. and define macros, without which no later part of the file will format
  806. correctly.  To solve this problem, `C-c C-r' allows you to designate a
  807. part of the file as containing essential commands; it is included before
  808. the specified region as part of the input to TeX.  The designated part
  809. of the file is called the "header".
  810.  
  811.    To indicate the bounds of the header in Plain TeX mode, you insert
  812. two special strings in the file.  Insert `%**start of header' before the
  813. header, and `%**end of header' after it.  Each string must appear
  814. entirely on one line, but there may be other text on the line before or
  815. after.  The lines containing the two strings are included in the header.
  816. If `%**start of header' does not appear within the first 100 lines of
  817. the buffer, `C-c C-r' assumes that there is no header.
  818.  
  819.    In LaTeX mode, the header begins with `\documentstyle' and ends with
  820. `\begin{document}'.  These are commands that LaTeX requires you to use
  821. in any case, so nothing special needs to be done to identify the header.
  822.  
  823.    The commands (`tex-buffer') and (`tex-region') do all of their work
  824. in a temporary directory, and do not have available any of the auxiliary
  825. files needed by TeX for cross-references; these commands are generally
  826. not suitable for running the final copy in which all of the
  827. cross-references need to be correct.  When you want the auxiliary
  828. files, use `C-c C-f' (`tex-file') which runs TeX on the current
  829. buffer's file, in that file's directory.  Before TeX runs, you will be
  830. asked about saving any modified buffers.  Generally, you need to use
  831. (`tex-file') twice to get cross-references correct.
  832.  
  833.    For LaTeX files, you can use BibTeX to process the auxiliary file
  834. for the current buffer's file.  BibTeX looks up bibliographic citations
  835. in a data base and prepares the cited references for the bibliography
  836. section.  The command `C-c TAB' (`tex-bibtex-file') runs the shell
  837. command (`tex-bibtex-command') to produce a `.bbl' file for the current
  838. buffer's file.  Generally, you need to do `C-c C-f' (`tex-file') once
  839. to generate the `.aux' file, then do `C-c TAB' (`tex-bibtex-file'), and
  840. then repeat `C-c C-f' (`tex-file') twice more to get the
  841. cross-references correct.
  842.  
  843.    Entering any kind of TeX mode runs the hooks `text-mode-hook' and
  844. `tex-mode-hook'.  Then it runs either `plain-tex-mode-hook' or
  845. `latex-mode-hook', whichever is appropriate.  For SliTeX files, it
  846. calls `slitex-mode-hook'.  Starting the TeX shell runs the hook
  847. `tex-shell-hook'.  *Note Hooks::.
  848.  
  849. 
  850. File: emacs,  Node: TeX Distrib,  Prev: TeX Print,  Up: TeX Mode
  851.  
  852. Unix TeX Distribution
  853. ---------------------
  854.  
  855.    TeX for Unix systems can be obtained from the University of
  856. Washington for a distribution fee.
  857.  
  858.    To order a full distribution, specify whether you prefer 1/4 inch
  859. QIC-24 or 4mm DAT tape (9-track reel-to-reel is no longer available)
  860. and send $210.00 for a (tar or cpio) cartridge, payable to the
  861. University of Washington to:
  862.  
  863.      Pierre MacKay
  864.      Department of Classics
  865.      Denny Hall, Mail Stop DH-10
  866.      University of Washington
  867.      Seattle, Washington 98195
  868.  
  869. Purchase orders are acceptable, but there is an extra charge of $10.00,
  870. to pay for processing charges.
  871.  
  872. For overseas orders please add $20.00 to the base cost for shipment via
  873. air parcel post, or $30.00 for shipment via courier.
  874.  
  875.    The normal distribution is a tar tape, blocked 20, 1600 bpi, on an
  876. industry standard 2400 foot half-inch reel.  The physical format for the
  877. 1/4 inch streamer cartridges is QIC-24.  System V tapes can be written
  878. in cpio format, blocked 5120 bytes, with ASCII headers.
  879.  
  880. 
  881. File: emacs,  Node: Nroff Mode,  Prev: TeX Mode,  Up: Text
  882.  
  883. Nroff Mode
  884. ==========
  885.  
  886.    Nroff mode is a mode like Text mode but modified to handle nroff
  887. commands present in the text.  Invoke `M-x nroff-mode' to enter this
  888. mode.  It differs from Text mode in only a few ways.  All nroff command
  889. lines are considered paragraph separators, so that filling will never
  890. garble the nroff commands.  Pages are separated by `.bp' commands.
  891. Comments start with backslash-doublequote.  Also, three special
  892. commands are provided that are not in Text mode:
  893.  
  894. `M-n'
  895.      Move to the beginning of the next line that isn't an nroff command
  896.      (`forward-text-line').  An argument is a repeat count.
  897.  
  898. `M-p'
  899.      Like `M-n' but move up (`backward-text-line').
  900.  
  901. `M-?'
  902.      Prints in the echo area the number of text lines (lines that are
  903.      not nroff commands) in the region (`count-text-lines').
  904.  
  905.    The other feature of Nroff mode is that you can turn on Electric
  906. Nroff mode.  This is a minor mode that you can turn on or off with `M-x
  907. electric-nroff-mode' (*note Minor Modes::.).  When the mode is on, each
  908. time you use RET to end a line that contains an nroff command that
  909. opens a kind of grouping, the matching nroff command to close that
  910. grouping is automatically inserted on the following line.  For example,
  911. if you are at the beginning of a line and type `. ( b RET', this
  912. inserts the matching command `.)b' on a new line following point.
  913.  
  914.    If you use Outline minor mode with Nroff mode (*note Outline
  915. Mode::.), heading lines are lines of the form `.H' followed by a number
  916. (the header level).
  917.  
  918.    Entering Nroff mode runs the hook `text-mode-hook', followed by the
  919. hook `nroff-mode-hook' (*note Hooks::.).
  920.  
  921. 
  922. File: emacs,  Node: Programs,  Next: Building,  Prev: Text,  Up: Top
  923.  
  924. Editing Programs
  925. ****************
  926.  
  927.    Emacs has many commands designed to understand the syntax of
  928. programming languages such as Lisp and C.  These commands can
  929.  
  930.    * Move over or kill balanced expressions or "sexps" (*note Lists::.).
  931.  
  932.    * Move over or mark top-level expressions--"defuns", in Lisp;
  933.      functions, in C (*note Defuns::.).
  934.  
  935.    * Show how parentheses balance (*note Matching::.).
  936.  
  937.    * Insert, kill or align comments (*note Comments::.).
  938.  
  939.    * Follow the usual indentation conventions of the language (*note
  940.      Program Indent::.).
  941.  
  942.    The commands for words, sentences and paragraphs are very useful in
  943. editing code even though their canonical application is for editing
  944. human language text.  Most symbols contain words (*note Words::.);
  945. sentences can be found in strings and comments (*note Sentences::.).
  946. Paragraphs per se don't exist in code, but the paragraph commands are
  947. useful anyway, because programming language major modes define
  948. paragraphs to begin and end at blank lines (*note Paragraphs::.).
  949. Judicious use of blank lines to make the program clearer will also
  950. provide useful chunks of text for the paragraph commands to work on.
  951.  
  952.    The selective display feature is useful for looking at the overall
  953. structure of a function (*note Selective Display::.).  This feature
  954. causes only the lines that are indented less than a specified amount to
  955. appear on the screen.
  956.  
  957. * Menu:
  958.  
  959. * Program Modes::     Major modes for editing programs.
  960. * Lists::             Expressions with balanced parentheses.
  961. * List Commands::     The commands for working with list and sexps.
  962. * Defuns::            Each program is made up of separate functions.
  963.                         There are editing commands to operate on them.
  964. * Program Indent::    Adjusting indentation to show the nesting.
  965. * Matching::          Insertion of a close-delimiter flashes matching open.
  966. * Comments::          Inserting, killing, and aligning comments.
  967. * Balanced Editing::  Inserting two matching parentheses at once, etc.
  968. * Symbol Completion:: Completion on symbol names of your program or language.
  969. * Documentation::     Getting documentation of functions you plan to call.
  970. * Change Log::        Maintaining a change history for your program.
  971. * Tags::              Go direct to any function in your program in one
  972.                         command.  Tags remembers which file it is in.
  973. * Emerge::          A convenient way of merging two versions of a program.
  974. * C Mode::          Special commands of C mode (and C++ mode).
  975. * Fortran::          Fortran mode and its special features.
  976. * Asm Mode::          Asm mode and its special features.
  977.  
  978. 
  979. File: emacs,  Node: Program Modes,  Next: Lists,  Up: Programs
  980.  
  981. Major Modes for Programming Languages
  982. =====================================
  983.  
  984.    Emacs also has major modes for the programming languages Lisp, Scheme
  985. (a variant of Lisp), Awk, C, C++, Fortran, Icon, Pascal, Perl and Tcl.
  986. There is also a major mode for makefiles, called Makefile mode.
  987.  
  988.    Ideally, a major mode should be implemented for each programming
  989. language that you might want to edit with Emacs; but often the mode for
  990. one language can serve for other syntactically similar languages.  The
  991. language modes that exist are those that someone decided to take the
  992. trouble to write.
  993.  
  994.    There are several forms of Lisp mode, which differ in the way they
  995. interface to Lisp execution.  *Note Executing Lisp::.
  996.  
  997.    Each of the programming language modes defines the TAB key to run an
  998. indentation function that knows the indentation conventions of that
  999. language and updates the current line's indentation accordingly.  For
  1000. example, in C mode TAB is bound to `c-indent-line'.  LFD is normally
  1001. defined to do RET followed by TAB; thus, it too indents in a
  1002. mode-specific fashion.
  1003.  
  1004.    In most programming languages, indentation is likely to vary from
  1005. line to line.  So the major modes for those languages rebind DEL to
  1006. treat a tab as if it were the equivalent number of spaces (using the
  1007. command `backward-delete-char-untabify').  This makes it possible to
  1008. rub out indentation one column at a time without worrying whether it is
  1009. made up of spaces or tabs.  Use `C-b C-d' to delete a tab character
  1010. before point, in these modes.
  1011.  
  1012.    Programming language modes define paragraphs to be separated only by
  1013. blank lines, so that the paragraph commands remain useful.  Auto Fill
  1014. mode, if enabled in a programming language major mode, indents the new
  1015. lines which it creates.
  1016.  
  1017.    Turning on a major mode runs a normal hook called the "mode hook",
  1018. which is the value of a Lisp variable.  Each major mode has a mode hook,
  1019. and the hook's name is always made from the mode command's name by
  1020. adding `-hook'.  For example, turning on C mode runs the hook
  1021. `c-mode-hook', while turning on Lisp mode runs the hook
  1022. `lisp-mode-hook'.  *Note Hooks::.
  1023.  
  1024. 
  1025. File: emacs,  Node: Lists,  Next: List Commands,  Prev: Program Modes,  Up: Programs
  1026.  
  1027. Lists and Sexps
  1028. ===============
  1029.  
  1030.    By convention, Emacs keys for dealing with balanced expressions are
  1031. usually Control-Meta characters.  They tend to be analogous in function
  1032. to their Control and Meta equivalents.  These commands are usually
  1033. thought of as pertaining to expressions in programming languages, but
  1034. can be useful with any language in which some sort of parentheses exist
  1035. (including human languages).
  1036.  
  1037.    These commands fall into two classes.  Some deal only with "lists"
  1038. (parenthetical groupings).  They see nothing except parentheses,
  1039. brackets, braces (whichever ones must balance in the language you are
  1040. working with), and escape characters that might be used to quote those.
  1041.  
  1042.    The other commands deal with expressions or "sexps".  The word `sexp'
  1043. is derived from "s-expression", the ancient term for an expression in
  1044. Lisp.  But in Emacs, the notion of `sexp' is not limited to Lisp.  It
  1045. refers to an expression in whatever language your program is written in.
  1046. Each programming language has its own major mode, which customizes the
  1047. syntax tables so that expressions in that language count as sexps.
  1048.  
  1049.    Sexps typically include symbols, numbers, and string constants, as
  1050. well as anything contained in parentheses, brackets or braces.
  1051.  
  1052.    In languages that use prefix and infix operators, such as C, it is
  1053. not possible for all expressions to be sexps.  For example, C mode does
  1054. not recognize `foo + bar' as a sexp, even though it *is* a C expression;
  1055. it recognizes `foo' as one sexp and `bar' as another, with the `+' as
  1056. punctuation between them.  This is a fundamental ambiguity: both `foo +
  1057. bar' and `foo' are legitimate choices for the sexp to move over if
  1058. point is at the `f'.  Note that `(foo + bar)' is a single sexp in C
  1059. mode.
  1060.  
  1061.    Some languages have obscure forms of expression syntax that nobody
  1062. has bothered to make Emacs understand properly.
  1063.  
  1064. 
  1065. File: emacs,  Node: List Commands,  Next: Defuns,  Prev: Lists,  Up: Programs
  1066.  
  1067. List And Sexp Commands
  1068. ======================
  1069.  
  1070. `C-M-f'
  1071.      Move forward over a sexp (`forward-sexp').
  1072.  
  1073. `C-M-b'
  1074.      Move backward over a sexp (`backward-sexp').
  1075.  
  1076. `C-M-k'
  1077.      Kill sexp forward (`kill-sexp').
  1078.  
  1079. `C-M-DEL'
  1080.      Kill sexp backward (`backward-kill-sexp').
  1081.  
  1082. `C-M-u'
  1083.      Move up and backward in list structure (`backward-up-list').
  1084.  
  1085. `C-M-d'
  1086.      Move down and forward in list structure (`down-list').
  1087.  
  1088. `C-M-n'
  1089.      Move forward over a list (`forward-list').
  1090.  
  1091. `C-M-p'
  1092.      Move backward over a list (`backward-list').
  1093.  
  1094. `C-M-t'
  1095.      Transpose expressions (`transpose-sexps').
  1096.  
  1097. `C-M-@'
  1098.      Put mark after following expression (`mark-sexp').
  1099.  
  1100.    To move forward over a sexp, use `C-M-f' (`forward-sexp').  If the
  1101. first significant character after point is an opening delimiter (`(' in
  1102. Lisp; `(', `[' or `{' in C), `C-M-f' moves past the matching closing
  1103. delimiter.  If the character begins a symbol, string, or number,
  1104. `C-M-f' moves over that.
  1105.  
  1106.    The command `C-M-b' (`backward-sexp') moves backward over a sexp.
  1107. The detailed rules are like those above for `C-M-f', but with
  1108. directions reversed.  If there are any prefix characters (single-quote,
  1109. backquote and comma, in Lisp) preceding the sexp, `C-M-b' moves back
  1110. over them as well.  The sexp commands move across comments as if they
  1111. were whitespace in most modes.
  1112.  
  1113.    `C-M-f' or `C-M-b' with an argument repeats that operation the
  1114. specified number of times; with a negative argument, it moves in the
  1115. opposite direction.
  1116.  
  1117.    Killing a sexp at a time can be done with `C-M-k' (`kill-sexp') or
  1118. `C-M-DEL' (`backward-kill-sexp').  `C-M-k' kills the characters that
  1119. `C-M-f' would move over, and `C-M-DEL' kills the characters that
  1120. `C-M-b' would move over.
  1121.  
  1122.    The "list commands" move over lists like the sexp commands but skip
  1123. blithely over any number of other kinds of sexps (symbols, strings,
  1124. etc).  They are `C-M-n' (`forward-list') and `C-M-p' (`backward-list').
  1125. The main reason they are useful is that they usually ignore comments
  1126. (since the comments usually do not contain any lists).
  1127.  
  1128.    `C-M-n' and `C-M-p' stay at the same level in parentheses, when
  1129. that's possible.  To move *up* one (or N) levels, use `C-M-u'
  1130. (`backward-up-list').  `C-M-u' moves backward up past one unmatched
  1131. opening delimiter.  A positive argument serves as a repeat count; a
  1132. negative argument reverses direction of motion and also requests
  1133. repetition, so it moves forward and up one or more levels.
  1134.  
  1135.    To move *down* in list structure, use `C-M-d' (`down-list').  In
  1136. Lisp mode, where `(' is the only opening delimiter, this is nearly the
  1137. same as searching for a `('.  An argument specifies the number of levels
  1138. of parentheses to go down.
  1139.  
  1140.    A somewhat random-sounding command which is nevertheless handy is
  1141. `C-M-t' (`transpose-sexps'), which drags the previous sexp across the
  1142. next one.  An argument serves as a repeat count, and a negative
  1143. argument drags backwards (thus canceling out the effect of `C-M-t' with
  1144. a positive argument).  An argument of zero, rather than doing nothing,
  1145. transposes the sexps ending after point and the mark.
  1146.  
  1147.    To set the region around the next sexp in the buffer, use `C-M-@'
  1148. (`mark-sexp'), which sets mark at the same place that `C-M-f' would
  1149. move to.  `C-M-@' takes arguments like `C-M-f'.  In particular, a
  1150. negative argument is useful for putting the mark at the beginning of
  1151. the previous sexp.
  1152.  
  1153.    The list and sexp commands' understanding of syntax is completely
  1154. controlled by the syntax table.  Any character can, for example, be
  1155. declared to be an opening delimiter and act like an open parenthesis.
  1156. *Note Syntax::.
  1157.  
  1158.